//
//  LANBWebPController.m
//  LanBKit_Example
//
//  Created by v on 2020/12/14.
//  Copyright © 2020 v. All rights reserved.
//

#import "LANBWebPController.h"
#import <SDWebImage/SDWebImage.h>
#import <SDWebImageWebPCoder/SDWebImageWebPCoder.h>

@interface LANBWebPController ()
@property (weak, nonatomic) IBOutlet UIImageView *imageViewTest1_;
@property (weak, nonatomic) IBOutlet UIImageView *imageViewTest2_;
@end

@implementation LANBWebPController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    /*
     if (@available(iOS 14, tvOS 14, macOS 11, watchOS 7, *)) {
         // iOS 14 supports WebP built-in
         [[SDImageCodersManager sharedManager] addCoder:[SDImageAWebPCoder sharedCoder]];
     } else {
         // iOS 13 does not supports WebP, use third-party codec
         [[SDImageCodersManager sharedManager] addCoder:[SDImageWebPCoder sharedCoder]];
     }
     */
    [[SDImageCodersManager sharedManager] addCoder:[SDImageWebPCoder sharedCoder]];
    
    NSURL *urlRemote = [NSURL URLWithString:@"https://appackeg.oss-cn-shenzhen.aliyuncs.com/images/weiming.webp"];
    [self.imageViewTest1_ sd_setImageWithURL:urlRemote];
    
    NSURL *urlLocal = [NSBundle.mainBundle URLForResource:@"gift_vip_shiningball" withExtension:@"webp"];
    [self.imageViewTest2_ sd_setImageWithURL:urlLocal];
    
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
